var Cookies = {

	list: null,
	
	getAll: function() {
		
		var str = document.cookie;
		
		this.list = [];
		
		if (str.length > 0) {
			
			var cookie, parts, cookieName, cookieVal;
			var list = str.split(';');
			
			for (var i = 0; i < list.length; i++) {
				cookie = list[i];
				parts  = cookie.split('=');
				cookieName = parts[0];
				cookieVal  = parts[1];
				//this.list[cookieName] = cookieVal;
				eval('this.list.' + cookieName + '= cookieVal') // firefox :-/
			}
		}
		return this.list;
	},

	get: function(cookieName) {
		if (this.list == null) this.getAll();
		var value = (typeof this.list[cookieName] == 'undefined') ? null : this.list[cookieName];
		if (value && value.charAt(0) == '%') value = unescape(value);
		return value;
	},

	set: function(cookieName, cookieValue, days) {
		
		if (this.list == null) this.getAll();		

		//cookieValue = escape(cookieValue);
		var date = new Date();
		var timeStr = (days) ? '' : "; expires=" + (date.getTime() + days * 86400);
		eval("document.cookie = '" + cookieName + "=" + cookieValue + timeStr + "';");
		this.getAll();
	}
}